package proyecto.tools;

import android.app.AlertDialog;
import android.content.Context;
import android.view.ViewGroup.LayoutParams;
import android.widget.ProgressBar;

public class AlertProgressBar {

	static AlertDialog alertDialog;
	public static void show(Context context)
	{
		
		if (alertDialog != null)
			try {
				dismiss();
			} catch (Exception e) {
				e.printStackTrace();
			}
			try {
				alertDialog = new AlertDialog.Builder(context).show();
				ProgressBar progressBar = new ProgressBar(context);
				progressBar.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
				alertDialog.setContentView(progressBar);	
			} catch (Exception e) {
				e.printStackTrace();
			}
	}
	
	public static void dismiss()
	{
		try {
			alertDialog.dismiss();	
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
}
